import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Test2 {
    public static void main(String[] args) {
        /*班级里有N个学生
    要求:
    70%的概率随机到男生
    30%的概率随机到女生
    "范闲","范建",范统","杜子腾","宋合泛","侯笼藤","朱益群","朱穆朗玛峰",
    "杜琦燕","袁明媛","李猜","田蜜蜜",

         */
        //1111111000 70%+30%
        //1.创建集合
        ArrayList<Integer> list = new ArrayList<Integer>();
        //2.添加元素
        Collections.addAll(list, 1,1,1,1,1,1,1);
        Collections.addAll(list,0,0,0);
        //3.打乱集合中的数据
        Collections.shuffle(list);
        //4.从集合中随机抽取0或1
        Random random = new Random();
        int index = random.nextInt(list.size());
        Integer number = list.get(index);
        System.out.println(number);

        //5.定义两个集合来储存男女生姓名
        ArrayList<String> boyList = new ArrayList<>();
        ArrayList<String> girlList = new ArrayList<>();

        Collections.addAll(boyList,"范闲","范建","范统","杜子腾","宋合泛","侯笼藤","朱益群","朱穆朗玛峰");
        Collections.addAll(girlList,"杜琦燕","袁明媛","李猜","田蜜蜜");

        //6.判断此时是从boyList里面还是girlList里面抽取
        if(number == 1){
            int boyIndex = random.nextInt(boyList.size());
            String name = boyList.get(boyIndex);
            System.out.println(name);
        }else{
            int girlIndex = random.nextInt(girlList.size());
            String name = girlList.get(girlIndex);
            System.out.println(name);
        }

    }
}
